home *** CD-ROM | disk | FTP | other *** search
- package com.extensibility.xml;
-
- import com.extensibility.util.Debug;
- import com.extensibility.util.XASet;
- import java.io.IOException;
- import java.io.Writer;
- import java.util.Enumeration;
- import java.util.EventObject;
- import java.util.Hashtable;
- import java.util.ResourceBundle;
- import java.util.Vector;
- import javax.swing.event.ChangeEvent;
- import javax.swing.event.ChangeListener;
- import javax.swing.event.EventListenerList;
-
- public abstract class BaseDeclaration implements ChangeListener, Cloneable {
- static String mostRecentName = "";
- protected boolean fireOnMetaPropChange;
- SchemaIntf schema;
- static ResourceBundle resourceBundle;
- String sampleData;
- public static String LINE_SEPARATOR = System.getProperty("line.separator");
- String name;
- CommentList comments;
- URI uri;
- Vector errors;
- MetaPropHash metaProps;
- boolean isInProlog;
- EventListenerList listenerList;
- DeclarationChangeEvent declChangeEvent;
-
- public static String getMostRecentName() {
- return mostRecentName;
- }
-
- public static void setResources(ResourceBundle var0) {
- resourceBundle = var0;
- }
-
- public String getSampleData() {
- Debug.assertAbstract();
- return null;
- }
-
- public void setSampleData(String var1) {
- this.sampleData = var1;
- }
-
- public void addChangeListener(ChangeListener var1) {
- this.listenerList.add(Class.forName("javax.swing.event.ChangeListener"), var1);
- }
-
- public void removeChangeListener(ChangeListener var1) {
- this.listenerList.remove(Class.forName("javax.swing.event.ChangeListener"), var1);
- }
-
- public void fireChangeEvent() {
- Object[] var1 = this.listenerList.getListenerList();
- this.declChangeEvent.set();
-
- for(int var2 = var1.length - 2; var2 >= 0; var2 -= 2) {
- if (var1[var2] == Class.forName("javax.swing.event.ChangeListener")) {
- ((ChangeListener)var1[var2 + 1]).stateChanged(this.declChangeEvent);
- }
- }
-
- }
-
- public void fireChangeEvent(int var1, Object var2) {
- Object[] var3 = this.listenerList.getListenerList();
- this.declChangeEvent.set(var1, var2);
-
- for(int var4 = var3.length - 2; var4 >= 0; var4 -= 2) {
- if (var3[var4] == Class.forName("javax.swing.event.ChangeListener")) {
- ((ChangeListener)var3[var4 + 1]).stateChanged(this.declChangeEvent);
- }
- }
-
- }
-
- public void stateChanged(ChangeEvent var1) {
- Object var2 = ((EventObject)var1).getSource();
- }
-
- public BaseDeclaration(String var1) {
- this.fireOnMetaPropChange = true;
- this.sampleData = null;
- this.errors = new Vector();
- this.isInProlog = false;
- this.listenerList = new EventListenerList();
- this.declChangeEvent = new DeclarationChangeEvent(this);
- this.name = var1;
- mostRecentName = var1;
- }
-
- public BaseDeclaration(String var1, Vector var2) {
- this(var1);
- this.comments = new CommentList(var2);
- }
-
- public BaseDeclaration clone(SchemaIntf var1, SchemaIntf var2, URI var3) {
- try {
- BaseDeclaration var4 = (BaseDeclaration)this.clone();
- var4.setURI(var3);
- var4.schema = null;
- return var4;
- } catch (CloneNotSupportedException var6) {
- Object var5 = null;
- return (BaseDeclaration)var5;
- }
- }
-
- public Object clone() throws CloneNotSupportedException {
- BaseDeclaration var1 = (BaseDeclaration)super.clone();
- var1.errors = null;
- var1.listenerList = new EventListenerList();
- if (this.comments != null) {
- var1.comments = (CommentList)this.comments.clone();
- }
-
- var1.errors = new Vector();
- var1.schema = null;
- var1.declChangeEvent = new DeclarationChangeEvent(var1);
- if (this.metaProps != null) {
- var1.metaProps = (MetaPropHash)this.metaProps.clone();
- }
-
- return var1;
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String var1) {
- if (!var1.equals(this.name)) {
- String var2 = this.name;
- this.name = var1;
- this.fireChangeEvent(1, var2);
- }
- }
-
- public boolean isSubordinate(BaseDeclaration var1) {
- return false;
- }
-
- public boolean references(InternalPEDeclaration var1) {
- return false;
- }
-
- public void setIsInProlog(boolean var1) {
- this.isInProlog = var1;
- }
-
- public boolean isInProlog() {
- return this.isInProlog;
- }
-
- protected MetaPropHash getMetaPropHash() {
- if (this.metaProps == null) {
- this.metaProps = new MetaPropHash();
- }
-
- return this.metaProps;
- }
-
- public Enumeration getMetaProps() {
- return this.metaProps == null ? null : this.getMetaPropHash().getMetaProps();
- }
-
- public void setFireOnMetaPropChange(boolean var1) {
- this.fireOnMetaPropChange = var1;
- }
-
- public boolean getFireOnMetaPropChange() {
- return this.fireOnMetaPropChange;
- }
-
- public void putMetaProp(String var1, String var2) {
- this.getMetaPropHash().putMetaProp(var1, var2);
- if (this.fireOnMetaPropChange) {
- this.fireChangeEvent();
- }
-
- }
-
- public void appendMetaProp(String var1, String var2) {
- this.getMetaPropHash().appendMetaProp(var1, var2);
- if (this.fireOnMetaPropChange) {
- this.fireChangeEvent();
- }
-
- }
-
- public Object getMetaProp(String var1) {
- return this.getMetaPropHash().getMetaProp(var1);
- }
-
- public void removeMetaProp(String var1) {
- this.getMetaPropHash().removeMetaProp(var1);
- if (this.fireOnMetaPropChange) {
- this.fireChangeEvent();
- }
-
- }
-
- public String getMetaPropAsString(String var1) {
- return this.getMetaPropHash().getMetaPropAsString(var1);
- }
-
- public void putMetaPropList(String var1, String var2) {
- this.getMetaPropHash().putMetaPropList(var1, var2);
- if (this.fireOnMetaPropChange) {
- this.fireChangeEvent();
- }
-
- }
-
- public void putMetaPropAttrs(String var1, Hashtable var2) {
- this.getMetaPropHash().putMetaPropAttrs(var1, var2);
- if (this.fireOnMetaPropChange) {
- this.fireChangeEvent();
- }
-
- }
-
- public abstract String getSource();
-
- public void write(Writer var1) throws IOException {
- var1.write(this.getCommentsAsSource());
- var1.write(this.getSource());
- var1.write(System.getProperty("line.separator"));
- }
-
- public String toString() {
- return this.getSource();
- }
-
- public abstract String getClassName();
-
- protected void releaseBindings() {
- }
-
- protected void establishBindings() {
- }
-
- public SchemaIntf getSchema() {
- return this.schema;
- }
-
- public void setSchema(SchemaIntf var1) {
- this.schema = var1;
- if (var1 == null) {
- this.releaseBindings();
- } else {
- this.establishBindings();
- }
-
- }
-
- public CommentList getCommentList() {
- return this.comments;
- }
-
- public boolean hasComments() {
- return this.comments != null && this.comments.size() > 0;
- }
-
- public Enumeration getComments() {
- return this.comments == null ? (new CommentList()).getComments() : this.comments.getComments();
- }
-
- public String getCommentsAsString(String var1, String var2) {
- return this.comments == null ? "" : this.comments.getCommentsAsString(var1, var2);
- }
-
- public String getCommentsAsSource() {
- return this.comments == null ? "" : this.comments.getCommentsAsSource();
- }
-
- public void addComment(Comment var1) {
- if (this.comments == null) {
- this.comments = new CommentList();
- }
-
- this.comments.addComment(var1);
- }
-
- public void removeComment(Comment var1) {
- this.comments.removeComment(var1);
- }
-
- public void updateComments(Vector var1, String var2) {
- if (this.comments == null) {
- this.comments = new CommentList();
- }
-
- this.comments.updateComments(var1, var2);
- this.fireChangeEvent();
- }
-
- public void setComments(Vector var1) {
- if (this.comments == null) {
- this.comments = new CommentList();
- }
-
- this.comments.setComments(var1);
- }
-
- public URI getURI() {
- return this.uri;
- }
-
- public void setURI(URI var1) {
- this.uri = var1;
- }
-
- public String getFirstError() {
- return !this.hasErrors() ? null : ((ParserException)this.errors.firstElement()).getMessage();
- }
-
- public boolean hasErrors() {
- return this.errors != null && !this.errors.isEmpty();
- }
-
- protected static void addPrerequisite(SchemaIntf var0, Vector var1, String var2, boolean var3) {
- if (var2 != null) {
- Vector var4 = DTDUtilities.extractNames(var2, (char)(var3 ? '%' : '&'));
-
- for(int var5 = 0; var5 < var4.size(); ++var5) {
- EntityDeclaration var6 = (EntityDeclaration)var0.getNamedDeclaration((String)var4.elementAt(var5), var3 ? Class.forName("com.extensibility.xml.ParameterEntityDeclaration") : Class.forName("com.extensibility.xml.GeneralEntityDeclaration"));
- if (var6 != null) {
- var1.addElement(var6);
- }
- }
-
- }
- }
-
- public Vector getPrerequisites(SchemaIntf var1) {
- return new Vector();
- }
-
- public void checkForErrors(SchemaIntf var1) {
- if (!var1.getShowErrors()) {
- this.errors.setSize(0);
- }
-
- if (this.getName().length() > 0 && !this.getName().equals("]]>") && this.getName().charAt(0) != '#' && !DTDParser.isName(this.getName())) {
- this.errors.addElement(new ParserException(224, this.getName()));
- }
-
- }
-
- public Vector getErrors() {
- return this.errors;
- }
-
- public void addError(String var1) {
- this.errors.addElement(new ParserException((Exception)null, var1));
- }
-
- public void addError(ParserException var1) {
- this.errors.addElement(var1);
- }
-
- public void addDependantsToSet(XASet var1) {
- }
-
- public String paramString() {
- return String.valueOf(String.valueOf(String.valueOf(String.valueOf(this.getClass().getName()).concat(String.valueOf("("))).concat(String.valueOf(this.getName()))).concat(String.valueOf(") uri = "))).concat(String.valueOf(this.uri == null ? "null" : this.uri.toSource()));
- }
- }
-